﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;


public partial class News : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Request.QueryString["cat"] != null)
            {
                int iCatID = int.Parse(Request.QueryString["cat"].ToString());
                get_ALL_NEWS_BY_CATEGORY(iCatID);                
            }
        }
    }

    public void get_ALL_NEWS_BY_CATEGORY(int iCatID)
    {
        if (BusLogic.News.get_ALL_NEWS_BY_CATEGORY(iCatID).Tables[0].Rows.Count > 0)
        {

            rpNewsList.DataSource = BusLogic.News.get_ALL_NEWS_BY_CATEGORY(iCatID);
            rpNewsList.DataBind();
            
           ltlCategoryName.Text = BusLogic.Category.get_CATEGORY(iCatID).Tables[0].Rows[0]["NAME"].ToString();
           Page.Title = ltlCategoryName.Text;
        }
        
    }
}
